<template>
    <div class="merchant_offer_discounts">
        <c-title text="卡密"></c-title>
        <div style="height: 20px;"></div>
        <van-cell-group inset>
            <van-field v-model.trim="card_no" label="卡号" placeholder="请输入卡号" input-align="right">
            </van-field>
            <van-field v-model.trim="card_pwd" type="textarea" label="卡密" placeholder="请输入卡密" input-align="right">
            </van-field>
            <div class="padding-10">
                <van-button type="primary" @click="submit" round block>提交</van-button>
            </div>


        </van-cell-group>
    </div>
</template>

<script>
export default {
    data() {
        return {
            card_no: "",
            card_pwd: ""
        };
    },
    activated() { },
    methods: {
        async submit() {
            let json = {
                card_no: this.card_no,
                card_pwd: this.card_pwd,
            }
            if (!this.card_no) {
                this.$toast("卡号不能为空");
                return;
            }
            if (!this.card_pwd) {
                this.$toast("卡密不能为空");
                return;
            }
            let { msg, result } = await $http.post("plugin.growth-pool.frontend.card.used-card", json, '.')
            this.$toast(msg);
            if (result) {
                this.$router.go(-1);
            }
        }
    }
};
</script>

<style scoped lang='scss'>
::v-deep .van-field__label {
    width: unset;
}

::v-deep .van-cell {
    line-height: 35px;
}

/** **/
</style>